package cn.kmust.booth.portal.security;

import cn.kmust.booth.portal.service.IAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

/**
 * @author XChao
 * @date 2020/7/18 - 10:13
 */
@Component
public class UserDetailsServiceImp implements UserDetailsService {

    @Autowired
    private IAdminService adminService;

    @Override
    public UserDetails loadUserByUsername(String phone) throws UsernameNotFoundException {
        return adminService.login(phone);
    }
}
